<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_payments', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('project_id');
            // 关联劳务人员 ID
            $table->unsignedBigInteger('user_id');
            // 工资发放周期，如 2024-09 表示 2024 年 9 月
            $table->string('payment_period');
            // 应发工资
            $table->decimal('pay', 10, 2);
            // 扣除项，如社保、罚款等存储多个扣除项信息
            $table->string('deductions')->nullable();
            // 实发工资
            $table->decimal('price', 10, 2);
            // 发放日期
            $table->date('payment_date')->nullable();
            // 发放状态，如已发放、待发放
            $table->string('payment_status')->nullable()->comment('paid', 'pending');
            // 支付方式，如现金、转账等
            $table->string('payment_method')->nullable();
            // 备注信息
            $table->string('remarks')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_payments');
    }
};
